import request from '@/utils/request'

export const addTactics = (data) => {
  return request({
    url: '/equipment/tactics/add',
    method: 'put',
    data: data
  })
}

export const updateTactics = (data) => {
  return request({
    url: '/equipment/tactics/update',
    method: 'put',
    data: data
  })
}
export const getTactics = ({ id, page, pageSize }, type) => {
  return request({
    url: '/equipment/tactics' + `/${type}`,
    method: 'post',
    data: {
      id: id,
      page: page,
      pageSize: pageSize,
    }
  })
}

export const getTacticsBySearch = (data, type) => {
  return request({
    url: '/equipment/tactics/search' + `/${type}`,
    method: 'post',
    data: data
  })
}

export const addProject = (data) => {
  return request({
    url: '/equipment/tactics/addProject',
    method: 'put',
    data: data
  })
}

export const getProject = (type, deptId) => {
  return request({
    url: '/equipment/tactics/getProject',
    method: 'post',
    params: {
      type: type,
      deptId: deptId
    }
  })
}

export const editProject = (data) => {
  return request({
    url: '/equipment/tactics/editProject',
    method: 'post',
    data: data
  })
}

export const delProject = (id) => {
  return request({
    url: '/equipment/tactics/delProject' + `/${id}`,
    method: 'delete',
  })
}

export const getHisTask = (deptId) => {
  return request({
    url: '/equipment/tactics/gethistask' + `/${deptId}`,
    method: 'get',
  })
}

export const getTask = () => {
  return request({
    url: '/equipment/tactics/getTask',
    method: 'get',
  })
}

export const getItems = (taskId, devideId) => {
  return request({
    url: '/equipment/tactics/getItems',
    method: 'post',
    params: {
      taskId: taskId,
      deviceId: devideId
    }
  })
}

export const sendHisItems = (data) => {
  return request({
    url: '/equipment/tactics/sendHisItems',
    method: 'post',
    data: data
  })
}

export const changeTacticsStatus = (ids, status) => {
  return request({
    url: '/equipment/tactics/changeStatus' + `/${ids}`,
    method: 'post',
    params: {
      status: status
    }
  })
}

export const getTacticsDevices = (tacticsId) => {
  return request({
    url: '/equipment/tactics/getttDevices' + `/${tacticsId}`,
    method: 'get',
  })
}
export const getTacticsProject = (projectId) => {
  return request({
    url: '/equipment/tactics/getttProject' + `/${projectId}`,
    method: 'get',
  })
}
export const delTacticsByIds = (tactaicsids) => {
  return request({
    url: '/equipment/tactics/del' + `/${tactaicsids}`,
    method: 'delete',
  })
}